package com.wanjia.estate.constant;

import lombok.AllArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

@AllArgsConstructor
public enum YtType {

    FWYT10("10", "住宅"),
    FWYT11("11", "成套住宅"),
    FWYT111("111", "别墅"),
    FWYT112("112", "高档公寓"),
    FWYT12("12", "非成套住宅"),
    FWYT13("13", "集体宿舍"),
    FWYT20("20", "工业、交通、仓储"),
    FWYT21("21", "工业"),
    FWYT22("22", "公共设施"),
    FWYT23("23", "铁路"),
    FWYT24("24", "民航"),
    FWYT25("25","航运"),
    FWYT26("26","公共运输"),
    FWYT27("27","仓储"),
    FWYT30("30","商业、金融、信息"),
    FWYT31("31","商业服务"),
    FWYT32("32","经营"),
    FWYT33("33","旅游"),
    FWYT34("34","金融保险"),
    FWYT35("35","电讯信息"),
    FWYT40("40","教育、医疗、卫生、科研"),
    FWYT419("41","教育"),
    FWYT42("42","医疗卫生"),
    FWYT43("43","科研"),
    FWYT50("50","文化、娱乐、体育"),
    FWYT51("51","文化"),
    FWYT52("52","新闻"),
    FWYT53("53","娱乐"),
    FWYT54("54","园林绿化"),
    FWYT55("55","体育"),
    FWYT60("60","办公"),
    FWYT70("70","军事"),
    FWYT809("80","其它"),
    FWYT81("81","涉外"),
    FWYT82("82","宗教"),
    FWYT83("83","监狱"),
    FWYT84("84","物管用房");


    private final String code;
    private final String name;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static YtType get(String code) {
        return Stream.of(values())
                .filter(d -> Objects.equals(code, d.code))
                .findFirst()
                .orElse(null);
    }
}
